cmake_minimum_required(VERSION 3.18)

file(GLOB_RECURSE SRC *.cpp *.hpp)

if(CMAKE_SYSTEM_NAME MATCHES "Windows")
list(APPEND CMAKE_MODULE_PATH D:\\library\\googletest )
message(STATUS "Windows +++++++++++++++++++++")
endif(CMAKE_SYSTEM_NAME MATCHES "Windows")

# project(Learning LANGUAGES CXX)
# for gtest
enable_testing()

# 查找 GTest 库
find_package(GTest REQUIRED)
find_package(OpenCV REQUIRED)



# find_package(CUDA REQUIRED)

# GTest 的头文件
include_directories(${GTEST_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(.)

if(SYSTEM.linux)
message(STATUS "========================================")
    
endif(SYSTEM.linux)

add_executable(Learning ${SRC})
# add_executable(Test ${SRC})

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
# 链接测试库
target_link_libraries( Learning
        ${GTEST_BOTH_LIBRARIES}
        pthread ${OpenCV_LIBRARIES})

gtest_discover_tests(Learning)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
message(STATUS "Link Windows libs")
message(STATUS "+++++++++++++++++++++${GTEST_LIBRARY}")
target_link_libraries( Learning
        ${GTEST_LIBRARY}
        ${GTEST_MAIN_LIBRARY}
        ${OpenCV_LIBRARIES})
endif(CMAKE_SYSTEM_NAME MATCHES "Linux")

# add_subdirectory(qttool)